package demo.entity;


public class OrderItem {
	private int orderId;
	private String itemId;
	private int num;
	private double price;
	
	public OrderItem() {
	}
	
	public OrderItem(int orderId, String itemId, int num, double price) {
		this.orderId = orderId;
		this.itemId = itemId;
		this.num = num;
		this.price = price;
	}
	
	public int getOrderId(){
		return orderId;
	}
	
	public String getItemId() {
		return itemId;
	}
	
	public int getNum() {
		return num;
	}
	
	public double getPrice() {
		return price;
	}
	
	public void setOrderId(int orderId) {
		this.orderId = orderId;
	}
	
	public void setItemId(String itemId) {
		this.itemId = itemId;
	}
	
	public void setNum(int num) {
		this.num = num;
	}
	
	public void setprice(double price) {
		this.price = price;
	}
	
	@Override
	public String toString() {
		StringBuffer stringBuffer = new StringBuffer();
		stringBuffer.append(String.format("%s,%s,%s,%s", orderId, itemId, String.valueOf(num), String.valueOf(price)));
		return stringBuffer.toString();
	}
	
	@Override
	public boolean equals(Object o) {
		if(o == this) return true;
		if(o instanceof OrderItem && this.itemId.equals(((OrderItem)o).getItemId())) return true;
		return false;
	}
}
